package com.iterator.iterator;

import java.util.Iterator;

//计算机学院
public class ComputerCollege implements College{

    private Department[] departments;
    int numberOfDepartment = 0  ;

    //初始化几个数据
    public ComputerCollege(){
        departments = new Department[5];
        departments[numberOfDepartment] = new Department("JAVA" , "JAVA");
        numberOfDepartment += 1 ;
        departments[numberOfDepartment] = new Department("PYTHON" , "PYTHON");
        numberOfDepartment += 1 ;
    }

    @Override
    public String getName() {
        return "计算机学院";
    }

    @Override
    public void addDepartment(String name, String desc) {
        departments[numberOfDepartment] = new Department(name , desc);
        numberOfDepartment += 1 ;
    }

    @Override
    public Iterator getIterator() {
        return new ComputerCollegeIterator(departments);
    }
}
